def get_nth_seq(n):
return 19 + (n - 1) * 9
def perfect_number(num):
counter = 0
for i in range(0, 10000000):
res = get_nth_seq(i)
calc = res
total = 0
while calc > 0:
total = total + calc % 10
calc = calc // 10
if total == 10:
counter += 1
if counter == num:
return res
def main():
print(perfect_number(int(input())))
if __name__ == '__main__':
main()
#include<bits/stdc++.h>
using namespace std;
int perfect(int n){
int ans = 0;
while(n){
ans += n%10;
n/=10;
}
return ans;
}
int main(){
int k;
cin >> k;
int num = 18;
int n = 0;
while(n<k){
num++;
if(perfect(num) == 10) n++;
}
cout << num << endl;
}
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |